<?
class Search_model extends CI_Model
{
	function __construct()
	{
		parent::__construct();
	}

	function blogs($val)
	{
		if (!is_arr($val))
			return false;

		$likes = array();
		foreach ($val as $word)
			$likes[]= '(pText LIKE "%'.$word.'%" OR pName LIKE "%'.$word.'%")';
		
		$this->db->where('('.join(' OR ', $likes).')');

		$this->db->where('dDeleted', 0);
		$this->db->order_by('id desc');
		return $this->db->get('article')->result();
	}
}
?>